<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7">
    <title>添加投票</title>

    <!--判断是否登陆-->
    <script type="text/javascript" src="../../vendor/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="../../js/config.js"></script>
    <script type="text/javascript" src="../../js/jquerySession.js"></script>
    <script type="text/javascript">
        if ($.session.get('token') == null) {
            alert("用户未登录！");
            window.location.href = "../../login.html"
        }
    </script>

    <link href="../../css/default.css" rel="stylesheet" type="text/css">
    <script language="javascript" type="text/javascript" src="../../vendor/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../vendor/kindeditor-all.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../vendor/zh-CN.js"></script>
    <script type="text/javascript">
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                uploadJson: baseUrl + '/uploadImage',//上传
//                fileManagerJson: 'http://127.0.0.1:8080/api/v1/fileUpload1',//文件管理
                allowFileManager: false,
                allowUpload:true,
                afterBlur: function () {
                    this.sync();
                }  //数据同步
            });
        });
    </script>
    <script type="text/javascript">window.focus();</script>
</head>
<style type="text/css">
    .box {margin: 0px auto;width: 100%;}
    .box ul {margin: 20px auto;padding-left: 0px;width: 710px;}
    .box ul li {list-style-type: none; }
    .box ul li input {height: 24px;width: 250px;}
    .box ul li span, input { margin: 5px 10px;}
    .box ul li {text-align: center; }
    .box ul li img {line-height: 19px; }
    .box ul .division {height: 10px;border-bottom: dashed #eeeeee 1px;margin-bottom: 10px;}
    .box ul .vote_selection {text-align: center;vertical-align: bottom; height: 20px; }
    .box ul .vote_selection .add_btn {
        line-height: 20px;
        width: 16px;
        height: 16px;
        padding-bottom: 3px;
        border: 0px;
        background: url("../../images/add.png") no-repeat;
    }
    .box ul li .del_btn {
        line-height: 20px;
        width: 16px;
        height: 16px;
        padding-bottom: 3px;
        border: 0px;
        background: url("../../images/del.png") no-repeat;
    }
    .input_style {
        margin-left: 40px;
        padding-left: 0px;
    }
</style>
<body>
<div class="box">
    <form method="post" id="myform">
        <ul id="voteList">
            <li>
                <span>投票名称</span>
                <input type="text" name="title" id="voteName" class="input_style">
            </li>
            <li>
                <span>投票开始日期</span>
                <input type="date" name="starTime" id="starTime">
            </li>
            <li>
                <span>投票结束日期</span>
                <input type="date" name="endTime" id="endTime">
            </li>
            <li class="division"></li>
            <li class="vote_selection">投票内容</li>
            <div class="pad-10" style="margin: 0 auto;width: 635px">
                <div class="col-tab">
                    <div id="div_setting_1" class="contentList pad-10">
                        <table width="100%" class="table_form ">
                            <tbody>
                            <tr>
                                <td>
                                <textarea id="editor_id" name="content" style="width: 600px; height: 300px; display: none;">

                                </textarea>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <li class="division"></li>
            <li class="vote_selection">投票选项
                <span>
                <input class="add_btn" type="button" onclick="addSelection()"/>&nbsp;
                <input type="button" class="del_btn"  onclick="delSelection()"/>
                </span>
            </li>
            <li class="division"></li>
            <li><span>选项1</span><input type="text" name="items"></li>
        </ul>
    </form>
</div>
<script type="text/javascript">
    function delSelection() {
        var voteList = document.getElementById("voteList");
        var count = voteList.childNodes.length;
        count--;
        if (count > 21) {
            voteList.removeChild(voteList.childNodes[count]);
        }
    }

    function addSelection() {
        var voteList = document.getElementById("voteList");
        var new_li = document.createElement("li");
        var count = voteList.childNodes.length - 21;
        new_li.innerHTML = "<span>选项" + count + "</span><input type=\"text\" name=\"items\">";
        voteList.appendChild(new_li);
    }
</script>
</body>
</html>